package com.iu.web.author;

import java.io.IOException;

import javax.jms.Destination;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.iu.service.author.ProducerService;

/**
 * 
 * @title: 值别
 * @description: {desc}
 * @company: gdyd
 * @className: DutyController.java
 * @author: fengzt
 * @createDate: 2015年8月6日
 * @updateUser: fengzt
 * @version: 1.0
 */
@Controller
@RequestMapping("producer")
public class ProducerController {
	private Logger log = Logger.getLogger(ProducerController.class);

	@Autowired
	private ProducerService producerService;
	
	@Autowired
	@Qualifier("queueDestination")
	private Destination destination;

	@RequestMapping("/sendMsg")
	public @ResponseBody String sendMsg() throws IOException {

		for (int i = 0; i < 1; i++) {
			producerService.sendMsg(destination, "你好，生产者！这是消息：" + (i + 1));
		}
		System.out.println("msg ---");
		return "sucess";
	}
}
